﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>随机抽取彩票</title>
    <script type="text/javascript" language="JavaScript">
        let oldNum = [];
        let newNum = [];
        let num;
        for(let i = 0;i<30;i++){
            oldNum.push(i<10 ? "0"+i:i);
        }
        for(let i = 0;i< 7;i++){
            num = oldNum.splice(Math.floor(Math.random() * oldNum.length),1);   // 选中随机数
            newNum.push(num);
        }
        alert("抽出号码是："+ newNum.sort());
    </script>
</head>
<body>

</body>
</html>